package com.example.test01;

import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

public class ListViewActivity extends MainActivity {
    ListView listView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setContentView(R.layout.listview);
        List<String> data = new ArrayList<String>();
        for (int i= 0; i<20; i++){
            data.add("test data info"+Integer.toString(i));
            listView = (ListView) this.findViewById(R.id.lv1);
        }
//        ArrayAdapter<String> adapter = new ArrayAdapter<>(this,android.R.layout.simple_list_item_1,data);
//        listView.setAdapter(adapter);
        ArrayAdapter<CharSequence> lvAdapter = ArrayAdapter.createFromResource(
                this,R.array.joke_name,android.R.layout.simple_dropdown_item_1line);
        listView.setAdapter(lvAdapter);
    }
}